<template>
  <div class="qualitySafety_container">
    <div class="left_box">
      <div class="box">
        <h6>初加工</h6>
        <div class="top">
          <div class="u2">
            <span :class="isShowG == 0 ? 'one' :'five'"
                  @click="bindClickG(0)">近一年</span>
            <span :class="isShowG == 1 ? 'one' :'five'"
                  @click="bindClickG(1)">近五年</span>
          </div>
        </div>
        <div id="three">
          <FoldedColumnMixing :option="optionSix"></FoldedColumnMixing>
        </div>
      </div>
      <div class="box">
        <h6>精加工</h6>
        <div class="top">
          <div class="u2">
            <span :class="isShowA == 0 ? 'one' :'five'"
                  @click="bindClickA(0)">近一年</span>
            <span :class="isShowA == 1 ? 'one' :'five'"
                  @click="bindClickA(1)">近五年</span>
          </div>
        </div>
        <div id="three">
          <FoldedColumnMixing :option="optionOne"></FoldedColumnMixing>
        </div>
      </div>
      <div class="box">
        <h6>深加工</h6>
        <div class="top">
          <div class="u2">
            <span :class="isShowB == 0 ? 'one' :'five'"
                  @click="bindClickB(0)">近一年</span>
            <span :class="isShowB == 1 ? 'one' :'five'"
                  @click="bindClickB(1)">近五年</span>
          </div>
        </div>
        <div id="three">
          <FoldedColumnMixing :option="optionTow"></FoldedColumnMixing>
        </div>
      </div>
    </div>
    <div class="center_box">
        <div class="statistics">
          <h6>汇总信息</h6>
          <Statistics :option="option"></Statistics>
        </div>
        <div class="box">
          <h6>加工企业</h6>
          <div class="checkbox">
            <el-checkbox v-model="checkedA">初加工</el-checkbox>
            <el-checkbox v-model="checkedB">精加工</el-checkbox>
            <el-checkbox v-model="checkedC">深加工</el-checkbox>
          </div>
          <TonghiaMap></TonghiaMap>
        </div>
    </div>
    <div class="right_box">
      <div class="box">
        <h6>初加工前十大企业</h6>
        <div id="three">
          <FoldedColumnMixing :option="optionThree"></FoldedColumnMixing>
        </div>
      </div>
      <div class="box">
        <h6>精加工前十大企业</h6>
        <div id="three">
          <FoldedColumnMixing :option="optionFour"></FoldedColumnMixing>
        </div>
      </div>
      <div class="box">
        <h6>深加工前十大企业</h6>
        <div id="three">
          <FoldedColumnMixing :option="optionFive"></FoldedColumnMixing>
        </div>
      </div>
    </div>
  </div>
  <!-- <div class="content">
    <ul class="left">
      <li class="left-one">
        <div class="box">
          <h6>初加工</h6>
          <div class="top">
            <div class="u2">
              <span :class="isShowG == 0 ? 'one' :'five'"
                    @click="bindClickG(0)">近一年</span>
              <span :class="isShowG == 1 ? 'one' :'five'"
                    @click="bindClickG(1)">近五年</span>
            </div>
          </div>
          <div id="three">
            <FoldedColumnMixing :option="optionSix"></FoldedColumnMixing>
          </div>
        </div>
      </li>
      <li class="left-one">
        <div class="box">
          <h6>精加工</h6>
          <div class="top">
            <div class="u2">
              <span :class="isShowA == 0 ? 'one' :'five'"
                    @click="bindClickA(0)">近一年</span>
              <span :class="isShowA == 1 ? 'one' :'five'"
                    @click="bindClickA(1)">近五年</span>
            </div>
          </div>
          <div id="three">
            <FoldedColumnMixing :option="optionOne"></FoldedColumnMixing>
          </div>
        </div>
      </li>
      <li class="left-one">
        <div class="box">
          <h6>深加工</h6>
          <div class="top">
            <div class="u2">
              <span :class="isShowB == 0 ? 'one' :'five'"
                    @click="bindClickB(0)">近一年</span>
              <span :class="isShowB == 1 ? 'one' :'five'"
                    @click="bindClickB(1)">近五年</span>
            </div>
          </div>
          <div id="three">
            <FoldedColumnMixing :option="optionTow"></FoldedColumnMixing>
          </div>
        </div>

      </li>
    </ul>
    <div class="center">
      <Statistics :option="option"></Statistics>
      <div class="box">
        <h6>加工企业</h6>
        <div class="checkbox">
          <el-checkbox v-model="checkedA">初加工</el-checkbox>
          <el-checkbox v-model="checkedB">精加工</el-checkbox>
          <el-checkbox v-model="checkedC">深加工</el-checkbox>
        </div>
      </div>
      <TonghiaMap></TonghiaMap>
    </div>
    <ul class="left">
      <li class="left-one">
        <div class="box">
          <h6>初加工前十大企业</h6>
          <div id="three">
            <FoldedColumnMixing :option="optionThree"></FoldedColumnMixing>
          </div>
        </div>
      </li>
      <li class="left-one">
        <div class="box">
          <h6>精加工前十大企业</h6>
          <div id="three">
            <FoldedColumnMixing :option="optionFour"></FoldedColumnMixing>
          </div>
        </div>
      </li>
      <li class="left-one">
        <div class="box">
          <h6>深加工前十大企业</h6>
          <div id="three">
            <FoldedColumnMixing :option="optionFive"></FoldedColumnMixing>
          </div>
        </div>
      </li>
    </ul>
  </div> -->

</template>

<script>
import { httpPreliminaryProcessChart, httpAccurateProcessChart, httpThoroughProcessChart, httpProcessEnterpriseChart, httpSummaryInformationChart } from '@/common/api/api'


import FoldedColumnMixing from '../../components/foldedColumnMixing.vue'
import Statistics from '../../components/statistics.vue'
import TonghiaMap from '../../components/tonghaiMap.vue'

export default {
  components: {
    FoldedColumnMixing,
    Statistics,
    TonghiaMap
  },
  data () {
    return {
      isShowA: 0,
      isShowB: 0,
      isShowC: 0,
      isShowD: 0,
      isShowF: 0,
      isShowG: 0,
      checkedA: true,
      checkedB: true,
      checkedC: true,
      option: [
        { id: 1, dataValue: '248.6', unit: '万吨', dataName: '初加工总产量', color: 'color:#6EC71E' },
        { id: 2, dataValue: '57.33', unit: '亿元', dataName: '初加工总产值', color: 'color:#F56E6A' },
        { id: 3, dataValue: '7.46', unit: '万吨', dataName: '精加工总产量', color: 'color:#818AF8' },
        { id: 4, dataValue: '3.02', unit: '亿元', dataName: '精加工总产值', color: 'color:#F69E0D' },
        { id: 5, dataValue: '10.38', unit: '万吨', dataName: '深加工总产值', color: 'color:#BE55E1' },
        { id: 6, dataValue: '9.57', unit: '亿元', dataName: '深加工总产值', color: 'color:#4FA8F9' },
      ],
      optionOne: {
        unitA: '单位：万吨',
        unitB: '单位: 亿元',
        nameA: '产量',
        nameB: '产值',
        maxA: 1,
        maxB: 10,
        intervalA: 0.2,
        intervalB: 2,
        colorA: 'rgba(129, 138, 248, 1)',
        colorB: 'rgba(72, 126, 234, 1)',
        brokenLineData: [],
        pieData: [],
        date: []
      },
      optionTow: {
        unitA: '单位：万吨',
        unitB: '单位: 亿元',
        nameA: '产量',
        nameB: '产值',
        maxA: 2,
        maxB: 2,
        intervalA: 0.2,
        intervalB: 0.2,
        colorA: 'rgba(190, 85, 225, 1)',
        colorB: 'rgba(72, 126, 234, 1)',
        brokenLineData: [],
        pieData: [],
        date: []
      },
      optionThree: {
        unitA: '年产值(亿元)',
        unitB: '公司规模(万元)',
        nameA: '年产值',
        nameB: '公司规模',
        maxA: 10,
        maxB: 1000,
        intervalA: 2,
        intervalB: 200,
        colorA: 'rgba(245, 110, 106, 1)',
        colorB: 'rgba(72, 126, 234, 1)',
        brokenLineData: [],
        pieData: [],
        date: []
      },
      optionFour: {
        unitA: '年产值(亿元)',
        unitB: '公司规模(万元)',
        nameA: '年产值',
        nameB: '公司规模',
        maxA: 10,
        maxB: 10000,
        intervalA: 2,
        intervalB: 2000,
        colorA: 'rgba(246, 158, 13, 1)',
        colorB: 'rgba(72, 126, 234, 1)',
        brokenLineData: [],
        pieData: [],
        date: []
      },
      optionFive: {
        unitA: '年产值(亿元)',
        unitB: '公司规模(万元)',
        nameA: '年产值',
        nameB: '公司规模',
        maxA: 10,
        maxB: 2000,
        intervalA: 2,
        intervalB: 200,
        colorA: 'rgba(79, 168, 249, 1)',
        colorB: 'rgba(72, 126, 234, 1)',
        brokenLineData: [],
        pieData: [],
        date: []
      },
      optionSix: {
        unitA: '单位：万吨',
        unitB: '单位: 亿元',
        nameA: '产量',
        nameB: '产值',
        maxA: 100,
        maxB: 10,
        intervalA: 20,
        intervalB: 2,
        colorA: 'rgba(246, 158, 13, 1)',
        colorB: 'rgba(72, 126, 234, 1)',
        brokenLineData: [],
        pieData: [],
        date: []
      },
      preliminaryProcessChart: {},
      accurateProcessChart: {}

    }
  },
  methods: {
    bindClickA (e) {
      if (e == 0) {
        this.isShowA = e
        this.optionOne.maxA = 1
        this.optionOne.maxB = 10
        this.optionOne.intervalA = 0.2
        this.optionOne.intervalB = 2
        this.optionOne.date = this.accurateProcessChart.dateListOneYear
        this.optionOne.brokenLineData = this.accurateProcessChart.yieldListOneYear
        this.optionOne.pieData = this.accurateProcessChart.outputValueListOneYear
      } else {
        this.isShowA = e
        this.optionOne.maxA = 10
        this.optionOne.maxB = 10
        this.optionOne.intervalA = 2
        this.optionOne.intervalB = 2
        this.optionOne.date = this.accurateProcessChart.dateListFiveYear
        this.optionOne.brokenLineData = this.accurateProcessChart.yieldListFiveYear
        this.optionOne.pieData = this.accurateProcessChart.outputValueListFiveYear
      }
    },
    bindClickB (e) {
      if (e == 0) {
        this.isShowB = e
        this.optionTow.maxA = 2
        this.optionTow.maxB = 2
        this.optionTow.intervalA = 0.2
        this.optionTow.intervalB = 0.2
        this.optionTow.date = this.thoroughProcessChart.dateListOneYear
        this.optionTow.brokenLineData = this.thoroughProcessChart.yieldListOneYear
        this.optionTow.pieData = this.thoroughProcessChart.outputValueListOneYear
      } else {
        this.isShowB = e
        this.optionTow.maxA = 20
        this.optionTow.maxB = 20
        this.optionTow.intervalA = 2
        this.optionTow.intervalB = 2
        this.optionTow.date = this.thoroughProcessChart.dateListFiveYear
        this.optionTow.brokenLineData = this.thoroughProcessChart.yieldListFiveYear
        this.optionTow.pieData = this.thoroughProcessChart.outputValueListFiveYear
      }
    },
    bindClickC (e) {
      if (e == 0) {
        this.isShowC = e
        this.optionThree.date = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
        this.optionThree.brokenLineData = [5, 3, 7, 8, 8, 2, 6, 9, 8, 6, 1, 4]
        this.optionThree.pieData = [3, 1, 3, 4, 3, 8, 3, 4, 8, 5, 10, 9]
      } else {
        this.isShowC = e
        this.optionThree.date = ['2006年', '2007年', '2008年', '2009年', '20010年']
        this.optionThree.brokenLineData = [3, 1, 3, 4, 3]
        this.optionThree.pieData = [5, 3, 7, 8, 8]
      }
    },
    getPreliminaryProcessChart () {
      httpPreliminaryProcessChart().then(res => {
        const { preliminaryProcessChart } = res.data
        this.preliminaryProcessChart = preliminaryProcessChart
        this.optionSix.date = preliminaryProcessChart.dateListOneYear
        this.optionSix.brokenLineData = preliminaryProcessChart.yieldListOneYear
        this.optionSix.pieData = preliminaryProcessChart.outputValueListOneYear
      })
    },
    getAccurateProcessChart () {
      httpAccurateProcessChart().then(res => {
        const { accurateProcessChart } = res.data
        this.accurateProcessChart = accurateProcessChart
        this.optionOne.date = accurateProcessChart.dateListOneYear
        this.optionOne.brokenLineData = accurateProcessChart.yieldListOneYear
        this.optionOne.pieData = accurateProcessChart.outputValueListOneYear
      })
    },
    getThoroughProcessChart () {
      httpThoroughProcessChart().then(res => {
        const { thoroughProcessChart } = res.data
        this.thoroughProcessChart = thoroughProcessChart
        this.optionTow.date = thoroughProcessChart.dateListOneYear
        this.optionTow.brokenLineData = thoroughProcessChart.yieldListOneYear
        this.optionTow.pieData = thoroughProcessChart.outputValueListOneYear
      })
    },
    getProcessEnterpriseChart (type) {
      httpProcessEnterpriseChart(type).then(res => {
        const { processEnterpriseChart } = res.data
        // 0：初加工 1：精加工 2：深加工
        if (type == 0) {
          this.optionThree.brokenLineData = processEnterpriseChart.annualOutputValueList
          this.optionThree.pieData = processEnterpriseChart.enterpriseScaleList
          this.optionThree.date = processEnterpriseChart.enterpriseAbbreviationList
        } else if (type == 1) {
          this.optionFour.brokenLineData = processEnterpriseChart.annualOutputValueList
          this.optionFour.pieData = processEnterpriseChart.enterpriseScaleList
          this.optionFour.date = processEnterpriseChart.enterpriseAbbreviationList
        } else if (type == 2) {
          this.optionFive.brokenLineData = processEnterpriseChart.annualOutputValueList
          this.optionFive.pieData = processEnterpriseChart.enterpriseScaleList
          this.optionFive.date = processEnterpriseChart.enterpriseAbbreviationList
        }

      })
    },
    getSummaryInformationChart () {
      httpSummaryInformationChart().then(res => {
        console.log(res);
        const { summaryInformationList } = res.data
        for (var i = 0; i < this.option.length; i++) {
          for (var j = 0; j < summaryInformationList.length; j++) {
            var channe = summaryInformationList[j];
            channe['color'] = this.option[i]
          }
        }
        this.option = summaryInformationList
      })
    }
  },
  created () {
    this.getPreliminaryProcessChart(),
      this.getAccurateProcessChart(),
      this.getThoroughProcessChart(),
      this.getProcessEnterpriseChart(0),
      this.getProcessEnterpriseChart(1),
      this.getProcessEnterpriseChart(2),
      this.getSummaryInformationChart()

  },
  mounted () {
  }
}
</script>

<style lang="scss" scoped>
.qualitySafety_container {
  height: 95.26%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  .left_box {
    width: calc(100% - 1.56% - 74%);
    height: 100%;
    .box {
      margin-bottom: 0.125rem;
      background-color: #fff;
      padding-top: 0.25rem;
      h6 {
        border-left: 0.05rem solid #487eea;
        padding-left: 0.15rem;
        margin-left: 0.25rem;
      }
      .unit {
        display: flex;
        justify-content: space-around;
        padding-top: 0.125rem;
        span {
          font-size: 0.15rem;
          font-family: Source Han Sans CN;
          font-weight: 400;
          color: #666666;
        }
      }
      .map {
        display: flex;
        justify-content: space-between;
        #one {
          width: 2.5rem;
          height: 2.5rem;
        }
        #two {
          width: 2.5rem;
          height: 2.5rem;
        }
      }
      .button {
        display: flex;
        justify-content: space-around;
        padding-bottom: 0.225rem;
        p {
          padding-left: 0.125rem;
        }
        p:nth-child(1) {
          border-left: 0.2rem solid #818af8;
        }
        p:nth-child(2) {
          border-left: 0.2rem solid #f69e0d;
        }
        p:nth-child(3) {
          border-left: 0.2rem solid #64b7ec;
        }
        p:nth-child(4) {
          border-left: 0.2rem solid #f56e6a;
        }
      }
      .top {
        position: relative;
        .u2 {
          position: absolute;
          right: 10%;
          bottom: -46;
          z-index: 9999;
          .one {
            width: 1rem;
            height: 0.325rem;
            background: #487eea;
            font-size: 0.175rem;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #ffffff;
            border: 1px solid #e4e4e4;
            text-align: center;
            line-height: 0.325rem;
            border-left-style: none;
            padding: 0.05rem 0.075rem;
          }
          .five {
            width: 1rem;
            height: 0.325rem;
            background: #fff;
            font-size: 0.175rem;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #666666;
            border: 1px solid #e4e4e4;
            text-align: center;
            line-height: 0.325rem;
            padding: 0.05rem 0.075rem;
          }
        }
      }
    }
  }
  .center_box {
    width: 50%;
    padding: 0 0.15rem 0.075rem 0.15rem;
    color: #fff;
    .statistics {
      padding-top: 0.25rem;
      background-color: #fff;
      h6 {
        border-left: 0.05rem solid #487eea;
        font-size: 0.225rem;
        color: #000;
        margin-left: 0.25rem;
        padding-left: 0.1125rem;
      }
    }
    .box {
      background-color: #fff;
      margin-bottom: 0.125rem;
      padding-top: 0.25rem;
      h6 {
        border-left: 0.05rem solid #487eea;
        font-size: 0.225rem;
        color: #000;
        margin-left: 0.25rem;
        padding-left: 0.1125rem;
      }
      .checkbox {
        margin-left: 0.25rem;
        padding-top: 0.275rem;
      }
      .double {
        padding-top: 0.3rem;
        ul {
          display: flex;
          justify-content: space-between;
        }
      }
    }
    .buttom {
      background-color: #fff;
      padding-top: 0.25rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      h6 {
        border-left: 0.05rem solid #487eea;
        font-size: 0.225rem;
        color: #000;
        margin-left: 0.25rem;
        padding-left: 0.1125rem;
      }
      .u2 {
        padding-right: 0.625rem;
        .one {
          width: 1rem;
          height: 0.325rem;
          background: #487eea;
          font-size: 0.175rem;
          font-family: Source Han Sans CN;
          font-weight: 500;
          color: #ffffff;
          border: 1px solid #e4e4e4;
          text-align: center;
          line-height: 0.325rem;
          border-left-style: none;
          padding: 0.05rem 0.075rem;
        }
        .five {
          width: 1rem;
          height: 0.325rem;
          background: #fff;
          font-size: 14px;
          font-family: Source Han Sans CN;
          font-weight: 500;
          color: #666666;
          border: 1px solid #e4e4e4;
          text-align: center;
          line-height: 0.325rem;
          padding: 0.05rem 0.075rem;
        }
      }
    }
  }
  .right_box {
    width: calc(100% - 1.56% - 74%);
    height: 100%;
    .box {
      margin-bottom: 0.125rem;
      background-color: #fff;
      padding-top: 0.25rem;
      h6 {
        border-left: 0.05rem solid #487eea;
        padding-left: 0.15rem;
        margin-left: 0.25rem;
      }
      .top {
        position: relative;
        .u2 {
          position: absolute;
          right: 10%;
          bottom: -46;
          z-index: 9999;
          .one {
            width: 1rem;
            height: 0.325rem;
            background: #487eea;
            font-size: 0.175rem;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #ffffff;
            border: 1px solid #e4e4e4;
            text-align: center;
            line-height: 0.325rem;
            border-left-style: none;
            padding: 0.05rem 0.075rem;
          }
          .five {
            width: 1rem;
            height: 0.325rem;
            background: #fff;
            font-size: 0.175rem;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #666666;
            border: 1px solid #e4e4e4;
            text-align: center;
            line-height: 0.325rem;
            padding: 0.05rem 0.075rem;
          }
        }
      }
    }
  }
}
/* .content {
  display: flex;
  overflow: hidden;
}
.content .left {
  box-sizing: content-box;
  box-sizing: border-box;
  width: 25%;
}
.left-one {
  height: 4.8125rem;
  background: #ffffff;
  margin-top: 0.125rem;
}
.left-one .box {
  padding-top: 0.25rem;
  margin-left: 0.15rem;
}
.left-one .box h6 {
  border-left: 0.05rem solid #487eea;
  padding-left: 0.15rem;
}
.left-one .box .unit {
  padding-top: 0.375rem;
  display: flex;
  justify-content: space-around;
}
.left-one .box .map {
  display: flex;
  justify-content: space-between;
}
.left-one .box .map #one {
  width: 2.5rem;
  height: 2.5rem;
}
.left-one .box .map #two {
  width: 2.5rem;
  height: 2.5rem;
}
.left-one .box #three {
  height: 4.375rem;
}

.left-one .box .button {
  display: flex;
  justify-content: space-around;
}
.box .button p {
  padding-left: 0.125rem;
}
.box .button p:nth-child(1) {
  border-left: 0.2rem solid #818af8;
}
.box .button p:nth-child(2) {
  border-left: 0.2rem solid #f69e0d;
}
.box .button p:nth-child(3) {
  border-left: 0.2rem solid #64b7ec;
}
.box .button p:nth-child(4) {
  border-left: 0.2rem solid #f56e6a;
}
.right-one {
  height: 4rem;
  background: #ffffff;
  margin-top: 0.125rem;
}
.content .center {
  flex: 1;
  background: #ffffff;
  margin: 0.125rem;
}
.center .box {
  margin-left: 0.25rem;
}
.center .box h6 {
  border-left: 0.05rem solid #487eea;
  padding-left: 0.15rem;
}
.center .box .checkbox {
  padding-top: 0.275rem;
}
.left-one .box .top {
  display: flex;
  justify-content: space-between;
  padding-top: 0.225rem;
  padding-right: 0.25rem;
}
.box .top {
  position: relative;
}
.left-one .box .top .u1 {
  font-size: 0.15rem;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #666666;
}
.box .top .u2 {
  position: absolute;
  left: 31%;
  bottom: -46;
  z-index: 9999;
}
.box .top .u2 .one {
  width: 1rem;
  height: 0.325rem;
  background: #487eea;
  font-size: 0.175rem;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #ffffff;
  border: 1px solid #e4e4e4;
  text-align: center;
  line-height: 0.325rem;
  border-left-style: none;
  padding: 0.05rem 0.075rem;
}
.box .top .u2 .five {
  width: 1rem;
  height: 0.325rem;
  background: #fff;
  font-size: 0.175rem;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #666666;
  border: 1px solid #e4e4e4;
  text-align: center;
  line-height: 0.325rem;
  padding: 0.05rem 0.075rem;
} */
</style>
